
package com.jiuqi.ccp.generator.form;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

/**
 * Form for ccpInfoGlsort.
 *
 * @author <a href="http://boss.bekk.no/boss/middlegen/"/>Middlegen</a>
 *
 * @struts.form name="ccpInfoGlsortForm"
 */
public class CcpInfoGlsortForm extends ActionForm {

   private final static SimpleDateFormat FORMAT = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss");

   private java.lang.String _cigGuid = null;
   private java.lang.String _name = null;
   private java.lang.String _glsCode = null;
   private java.lang.String _parentCode = null;
   private java.lang.String _leafFlag = null;
   private java.lang.String _strucCode = null;
   private java.lang.String _remark = null;

   /**
    * Standard constructor.
    */
   public CcpInfoGlsortForm() {
   }

   /**
    * Returns the cigGuid
    *
    * @return the cigGuid
    */
   public java.lang.String getCigGuid() {
      return _cigGuid;
   }

   /**
    * Sets the cigGuid
    *
    * @param cigGuid the new cigGuid value
    */
   public void setCigGuid(java.lang.String cigGuid) {
      _cigGuid = cigGuid;
   }
   /**
    * Returns the name
    *
    * @return the name
    */
   public java.lang.String getName() {
      return _name;
   }

   /**
    * Sets the name
    *
    * @param name the new name value
    */
   public void setName(java.lang.String name) {
      _name = name;
   }
   /**
    * Returns the glsCode
    *
    * @return the glsCode
    */
   public java.lang.String getGlsCode() {
      return _glsCode;
   }

   /**
    * Sets the glsCode
    *
    * @param glsCode the new glsCode value
    */
   public void setGlsCode(java.lang.String glsCode) {
      _glsCode = glsCode;
   }
   /**
    * Returns the parentCode
    *
    * @return the parentCode
    */
   public java.lang.String getParentCode() {
      return _parentCode;
   }

   /**
    * Sets the parentCode
    *
    * @param parentCode the new parentCode value
    */
   public void setParentCode(java.lang.String parentCode) {
      _parentCode = parentCode;
   }
   /**
    * Returns the leafFlag
    *
    * @return the leafFlag
    */
   public java.lang.String getLeafFlag() {
      return _leafFlag;
   }

   /**
    * Sets the leafFlag
    *
    * @param leafFlag the new leafFlag value
    */
   public void setLeafFlag(java.lang.String leafFlag) {
      _leafFlag = leafFlag;
   }
   /**
    * Returns the strucCode
    *
    * @return the strucCode
    */
   public java.lang.String getStrucCode() {
      return _strucCode;
   }

   /**
    * Sets the strucCode
    *
    * @param strucCode the new strucCode value
    */
   public void setStrucCode(java.lang.String strucCode) {
      _strucCode = strucCode;
   }
   /**
    * Returns the remark
    *
    * @return the remark
    */
   public java.lang.String getRemark() {
      return _remark;
   }

   /**
    * Sets the remark
    *
    * @param remark the new remark value
    */
   public void setRemark(java.lang.String remark) {
      _remark = remark;
   }


   /**
    * Validate the properties that have been set from this HTTP request,
    * and return an <code>ActionErrors</code> object that encapsulates any
    * validation errors that have been found.  If no errors are found, return
    * <code>null</code> or an <code>ActionErrors</code> object with no
    * recorded error messages.
    *
    * @param mapping The mapping used to select this instance
    * @param request The servlet request we are processing
    */
   public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
      ActionErrors errors = new ActionErrors();
      // test for nullity
      if(getCigGuid() == null) {
         errors.add("cigGuid", new ActionError("error.cigGuid.required"));
      }
      if(getName() == null) {
         errors.add("name", new ActionError("error.name.required"));
      }
      if(getGlsCode() == null) {
         errors.add("glsCode", new ActionError("error.glsCode.required"));
      }
      if(getLeafFlag() == null) {
         errors.add("leafFlag", new ActionError("error.leafFlag.required"));
      }
      // TODO test format/data
      return errors;
   }
}
